using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 子弹增强组件
/// 存储子弹的增强效果（伤害倍数、额外伤害、Buff等）
/// </summary>
public class BulletEnhancement : MonoBehaviour
{
    private float m_DamageMultiplier = 1.0f;
    private long m_BonusDamage = 0;
    private List<BuffData> m_BuffsToAdd = new List<BuffData>();
    private List<InstantEffectData> m_EffectsToAdd = new List<InstantEffectData>();

    public float DamageMultiplier => m_DamageMultiplier;
    public long BonusDamage => m_BonusDamage;
    public List<BuffData> BuffsToAdd => m_BuffsToAdd;
    public List<InstantEffectData> EffectsToAdd => m_EffectsToAdd;

    public void SetDamageMultiplier(float multiplier)
    {
        m_DamageMultiplier = multiplier;
    }

    public void SetBonusDamage(long damage)
    {
        m_BonusDamage = damage;
    }

    public void SetBuffsToAdd(List<BuffData> buffs)
    {
        m_BuffsToAdd = buffs ?? new List<BuffData>();
    }

    public void SetEffectsToAdd(List<InstantEffectData> effects)
    {
        m_EffectsToAdd = effects ?? new List<InstantEffectData>();
    }

    public void CopyFrom(BulletEnhancement other)
    {
        if (other == null)
        {
            return;
        }

        m_DamageMultiplier = other.m_DamageMultiplier;
        m_BonusDamage = other.m_BonusDamage;
        m_BuffsToAdd = new List<BuffData>(other.m_BuffsToAdd);
        m_EffectsToAdd = new List<InstantEffectData>(other.m_EffectsToAdd);
    }
}

